package com.sky.task;


import com.sky.context.BaseContext;
import com.sky.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Slf4j
@Component
public class MyTask {


    @Autowired
    private OrderService orderService;
    @Scheduled(cron = "0 0 1 * * ?")
    public void cleanup(){
        log.info("清理过期订单");
        Long currentId = BaseContext.getCurrentId();
    }
//    @Scheduled(cron = "0/5 * * * * ?")
//    public void executeTask(){
//        log.info("执行定时任务:{}",new Date());
//    }

    public static void main(String[] args) {
        int i = 1;
        System.out.println("初始数据：" + i);
        System.out.println("初始数据对应的二进制字符串：" + Integer.toBinaryString(i));
        i <<= 31;
        System.out.println("左移 32 位后的数据 " + i);
        System.out.println("左移 32 位后的数据对应的二进制字符 " + Integer.toBinaryString(i));
    }

}
